package ru.ee.objects;

import javax.microedition.khronos.opengles.GL10;

import android.view.MotionEvent;
import framework.GameScreen;
import framework.graphics.ScaledAnimation;
import framework.graphics.Texture;
import framework.managers.TextureManager;
import framework.objects.ui.UI;

public class StringPanel extends UI {

	private StringBtn[] buttons = new StringBtn[6];
	
	public StringPanel(GameScreen screen, String resFolderName, float x, float y, float dx) {
		super(screen);
		this.x = x;
		this.y = y;
		for (int i = 0; i < 6; i++) {
			buttons[i] = new StringBtn(screen, this, x + i * dx, y, 
					TextureManager.getTexture(resFolderName + "/s" + (i + 1) + ".png"),
					new ScaledAnimation(1000, new Texture[] {TextureManager.getTexture(resFolderName + "/s" + (i + 1) + ".png")}, 0.5f, 1, 1, 0.5f, 1, 1, 40 ,40),
					resFolderName + "/s" + (i + 1) + ".mp3");
		}
	}

	@Override
	public void handle(MotionEvent event) {
		for (StringBtn button : buttons) {
			button.handle(event);
		}
	}

	@Override
	protected void initPresentation() {
		// TODO Auto-generated method stub		
	}

	@Override
	public void draw(GL10 gl, float deltaTime) {
		for (StringBtn button : buttons) {
			button.draw(gl, deltaTime);
		}
	}

}
